<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let set = new Set()
        set.add(1)
        const newSet = new Set([...set])
        newSet.forEach(item => {
            set.delete(1)
            set.add(1)
            console.log('遍历中set');
        })

        let arr = [1]
        // 数组不会
        arr.forEach(item => {
            arr.splice(0, 1)
            arr.push(1)
            console.log('遍历中');
            
        })
    </script>    
</body>
</html>